package edu.hz.userservice.controller;


import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @HystrixCommand(fallbackMethod = "userFailBack",commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds",value = "2000")
    })



    @GetMapping("/user/user-info")
        public String userInfo(){
            try {
                Thread.sleep(4000);
            }catch (InterruptedException e){
                throw new RuntimeException(e);
            }
            return "sjy -14";
        }

        public String userFailBack(){return "sjy-14 is come";}
}
